package com.user.query.concurrent;

import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by bgt on 2017/3/15.
 */
public class AtomicIntegerTest implements Runnable{
    private AtomicInteger atomicInteger=new AtomicInteger(0);
    private void addorget(){
        atomicInteger.addAndGet(2);
    }
    @Override
    public void run() {
        while (true)
        addorget();
    }

    public static void main(String[] args) {
        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("终止了");
                System.exit(0);
            }
        },5000);
    }
}
